package com.losdun.common.sms;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author Sword.Ye
 * @Date 2025/8/22
 **/

@Configuration
@EnableConfigurationProperties(AliyunSmsProperties.class)
@Slf4j
@Data
public class AliyunSmsConfiguration {

    private final AliyunSmsProperties properties;

    @Autowired
    public AliyunSmsConfiguration(AliyunSmsProperties properties) {
        this.properties = properties;
    }

    @Bean
    public AliyunSmsClient aliyunSmsClient(){
        if(properties==null){
            throw new RuntimeException("brother阿里云短信配置未配置啊!");
        }
       return new AliyunSmsClient(properties);
    }

}
